package com.bytedance.scenedemo.benchmark.performance;

import com.bytedance.scene.Scene;
import com.bytedance.scene.navigation.NavigationSceneGetter;
import com.bytedance.scenedemo.ResourceTable;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.StackLayout;
import ohos.agp.window.dialog.ToastDialog;

/**
 * Created by JiangQi on 8/21/18.
 */
public class EmptyAppCompatScene extends Scene{
    @Override
    public Component onCreateView(LayoutScatter scatter, ComponentContainer container, Intent intent) {
        Component layout=scatter.parse(ResourceTable.Layout_emptyappcompat_scene,container,false);

        long a = System.currentTimeMillis() - PerformanceDemo.getStartTimestamp();
        showToast("启动耗时："+a+"ms");

        StackLayout layout_back = (StackLayout) layout.findComponentById(ResourceTable.Id_empty_scene_layout_back);
        layout_back.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                NavigationSceneGetter.requireNavigationScene(EmptyAppCompatScene.this).pop();
            }
        });

        return layout;
    }
}
